//
//  ZWBOneImageCell.m
//  Cat
//
//  Created by dllo on 15/11/28.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ZWBOneImageCell.h"
#import "TimeTool.h"
@implementation ZWBOneImageCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)setArr:(NSArray *)arr {
    self.pic1.image = NULL;
    self.pic2.image = NULL;
    self.picImageView.image = NULL;
    if (arr.count == 3) {
        
        [self.pic1 sd_setImageWithURL:[NSURL URLWithString:arr[1]]placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x"]];
        [self.picImageView sd_setImageWithURL:[NSURL URLWithString:arr[0]]placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x"]];
        [self.pic2 sd_setImageWithURL:[NSURL URLWithString:arr[2]]placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x"]];
    }else if (arr.count == 1) {
        
        [self.picImageView sd_setImageWithURL:[NSURL URLWithString:arr[0]]placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x"]];
    } else if (arr.count == 2) {
        
        [self.pic1 sd_setImageWithURL:[NSURL URLWithString:arr[1]]placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x"]];
        [self.picImageView sd_setImageWithURL:[NSURL URLWithString:arr[0]]placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x"]];
    }

}

- (void)setDic:(NSDictionary *)dic {
    
    HotModel *model = [[HotModel alloc] init];
    model.likeUids = dic[@"likeUids"];
    self.commentsView.HeaderModel = model;
    
    self.wordLabel.text = dic[@"content"][@"word"];
    self.timeLabel.text = [TimeTool Whattime:dic[@"content"][@"time"]];
    self.likeLabel.text = [NSString stringWithFormat:@"%@", dic[@"likes"]];
    self.commentsLabel.text = [NSString stringWithFormat:@"%@", dic[@"comments"]];
    
}

- (void)setModel:(HotModel *)model {
    
    // 个人信息

    [ToolNetWorking ToolNetWorking:[NSString stringWithFormat:@"http://user.huapipi.com/userinfo/basic.do?uid=%@", model.uid] block:^(id result) {
        self.nameLabel.text = [NSString stringWithFormat:@"%@", result[@"nickname"]];
        [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:result[@"portrait"]] placeholderImage:[UIImage imageNamed:@"ooopic_1445565008@2x.png"]];
    }];
    }

@end
